
ENTRYOFFSET = 0xc0001500
PLATFORM = elf_i386

ASM = nasm
CC = gcc
LD = ld
CFLAGS = -I lib/ lib/kernel/ -m32 -c

run:
	nasm -I boot/include/ boot/mbr.S -o boot/mbr.bin
	nasm -I boot/include/ boot/loader.S -o boot/loader.bin
	nasm -f elf -o lib/kernel/print.o lib/kernel/print.S
	dd if=boot/mbr.bin of=hd60M.img bs=512 count=1 conv=notrunc
	dd if=boot/loader.bin of=hd60M.img bs=512 seek=2 count=4 conv=notrunc
	gcc -m32 -I lib/ -I lib/kernel -c -o kernel/main.o kernel/main.c 
	#gcc -m32 -I lib/kernel -c -o kernel/main.o kernel/main.c 
	ld -m $(PLATFORM) -s -Ttext $(ENTRYOFFSET) -e main -o kernel.bin kernel/main.o lib/kernel/print.o
	dd if=kernel.bin of=hd60M.img bs=512 count=200 seek=9 conv=notrunc
	rm -rf *.o kernel/*.o


